"""meiduo_mall URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
from django.http import HttpResponse
# 为了记录我们的日志 我们来定义一个 视图函数
from django.urls import register_converter
from utils.converters import UserCountConverter, MobileCountConverter

register_converter(UserCountConverter, 'usercount')
register_converter(MobileCountConverter, 'mobilecount')


def test(request):
    # 1. 导入系统的日志
    import logging
    # 2. 根据配置信息,创建日志器
    logger = logging.getLogger('django')
    # 3. 记录日志
    # 3.1 如果有警告
    logger.warning('这里有一个警告')
    # 3.2 如果有错误
    logger.error('error')
    # 3.3 如果记录信息
    logger.info('123')

    return HttpResponse('test')


urlpatterns = [
    path('admin/', admin.site.urls),
    path('test/', test),
    path('', include('apps.users.urls')),
    path('', include('apps.verifitions.urls')),
    path('', include('apps.oauth.urls')),
    path('', include('apps.areas.urls')),
    path('',include('apps.contents.urls')),
    path('',include('apps.goods.urls')),

]
